﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Diggins.Jigsaw;

namespace Parser
{
    public class SentenceGrammar : Grammar
    {
        public static Rule word = Node(Pattern(@"\w+"));
        public static Rule ws = Pattern(@"\s+");
        public static Rule eos = CharSet("!.?");
        public static Rule sentence = Node(ZeroOrMore(word |
        ws) + eos);
        public static Rule sentences = OneOrMore(sentence +
            Opt(ws));
        static SentenceGrammar()
        {
            Grammar.InitGrammar(typeof(SentenceGrammar));
        }
    }
}
